home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / docs / misc / amigapl.9801.lzh / log / text0155.txt < prev    next >
Encoding:
Text File  |  1998-01-30  |  3.5 KB  |  115 lines

  1. On 05-Jan-98, Marcin Juszkiewicz (Szczepan/SubBlaBla) wrote:
  2. >  Hi !
  3. >   Jakis  czas  temu  zaczalem  pisac playerka do sampli.  W chwili obecnej
  4. >program nie strzela Enforcerem ale mam teraz inny problem. Poniewaz program
  5. >ma byc 100% zgodny z systemem to do odtwarzania uzywam audio.device i tu
  6. >pojawia sie problem - by odtworzyc sampla dluzszego niz 64KB trzeba uzyc
  7. >double bufferingu. Znalazlem gdzies odpowiednia rutynke i zaadoptowalem ja
  8. >do wlasnych potrzeb. Calosc jest ponizej. Niestety to nie dziala - moze
  9. >ktos wie co i potrafi wskazac bledy ??? Zaznaczam, ze wolalbym odpowiedzi
  10. >jak to zrobic w E ale nie pogardze procedura w C lub Pascalu.
  11.  
  12. Nie znam E, ale na pierwszy zrzut oka widzac pare bledow:
  13.  
  14. >DEF au_replyport  = NIL : PTR TO mp,
  15. >    au_replyport1 = NIL : PTR TO mp,
  16. >    au_replyport2 = NIL : PTR TO mp,
  17. >    au_audioio  = NIL : PTR TO ioaudio,
  18. >    au_audioio1 = NIL : PTR TO ioaudio,
  19. >    au_audioio2 = NIL : PTR TO ioaudio
  20. >  IF (au_replyport  := CreateMsgPort())      = NIL THEN Raise(ERR_NO_PORT)
  21. ^
  22. To jest zbedne - au_replyport jest tylko pointerem.
  23.  
  24. >  IF (au_replyport1 := CreateMsgPort())      = NIL THEN Raise(ERR_NO_PORT)
  25. >  IF (au_replyport2 := CreateMsgPort())      = NIL THEN Raise(ERR_NO_PORT)
  26. >  IF (au_audioio    := New (SIZEOF ioaudio)) = NIL THEN Raise(ERR_NO_MEM)
  27. ^
  28. To jest zbedne - audioio jest tylko pointerem.
  29.  
  30. >  IF (au_audioio1   := New (SIZEOF ioaudio)) = NIL THEN Raise(ERR_NO_MEM)
  31. >  IF (au_audioio2   := New (SIZEOF ioaudio)) = NIL THEN Raise(ERR_NO_MEM)
  32. >  au_audioio1::io::mn::ln.pri   := 127
  33. >  au_audioio1::io::mn.replyport := au_replyport1
  34. >  au_audioio1.allockey := NIL
  35. >  au_audioio1.data     := [1,2,4,8]:CHAR
  36. >  au_audioio1.length   := 4
  37. >  IF (au_allocerror := OpenDevice('audio.device',NIL,au_audioio1,NIL)) THEN
  38. >Raise(ERR_NO_AUDIO)
  39. >PROC au_PlaySample(wf,sl)
  40. >  DEF position = 0,
  41. >      samplen,
  42. >      nowlen,
  43. >      port
  44. >  samplen  := sl
  45. >  position := wf
  46. >  stop()
  47. >  au_audioio1::io.command := CMD_WRITE
  48. >  au_audioio1::io.flags := ADIOF_PERVOL
  49. >  au_audioio1.period := Div(au_clock,frequency)
  50. >  au_audioio1.volume := 64
  51. >  au_audioio1.cycles := 1
  52. >  au_audioio2 := au_audioio1
  53. ^
  54. Tutaj ustawiles oba audioio na ten sam pointer. Powinienes skopiowac
  55. ustawienia audioio1 do audioio2.
  56.  
  57. >  au_audioio1::io::mn.replyport := au_replyport1
  58. >  au_audioio2::io::mn.replyport := au_replyport2
  59. ^
  60. I te operacje odbywaja sie na tym samym audioio.
  61.  
  62. >  au_audioio::io::mn.replyport  := au_replyport
  63. ^ Ta linia jest zbedna. 
  64.  
  65. >-> Double buffering
  66. >  au_audioio1.data   := wf
  67. >  au_audioio1.length := 64000
  68. >  sl  := sl - 64000
  69. >  IF sl > 64000
  70. >    nowlen := 64000
  71. >  ELSE
  72. >    nowlen := sl
  73. >  ENDIF      
  74. >  au_audioio2.data   := wf + 64000
  75. >  au_audioio2.length := nowlen
  76. >  sl := sl -nowlen
  77. >  beginio(au_audioio1)
  78. >  beginio(au_audioio2)
  79. >  au_replyport := au_replyport1
  80. >  au_audioio   := au_audioio1
  81. >  port := 1
  82. >  WHILE sl > 0  
  83. >    Wait(au_replyport)
  84. >    GetMsg(au_replyport)
  85. >    IF sl > 64000
  86. >      au_audioio.data   := position
  87. >      au_audioio.length := 64000
  88. >      sl := sl - 64000
  89. >      position := position + 64000
  90. >    ELSE
  91. >      au_audioio.data   := position
  92. >      au_audioio.length := sl
  93. >      position := position + sl
  94. >      sl := 0
  95. >    ENDIF      
  96. >    beginio(au_audioio)
  97. >    SELECT port
  98. >      CASE 1
  99. >        au_audioio   := au_audioio2
  100. >        au_replyport := au_replyport2
  101. >        port := 2
  102. >      CASE 2
  103. >        au_audioio   := au_audioio1
  104. >        au_replyport := au_replyport1
  105. >        port := 1
  106. >    ENDSELECT
  107. >  ENDWHILE
  108. >ENDIF
  109. >ENDPROC
  110.  
  111. Docent
  112. --
  113. You only have a problem when you think you have a problem.
  114.  
  115.